
import Head from 'next/head'

<Head>
  <script>
    {
      `(function() {
         var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?e60fb290e204e04c5cb6f79b0ac1e697";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
       })();`
    }
  </script>
</Head>

![LangChain](https://pica.zhimg.com/50/v2-56e8bbb52aa271012541c1fe1ceb11a2_r.gif)



GCS文件存储
=================================================

这篇文章介绍了如何从Google Cloud Storage (GCS)文件对象中加载文档对象。

```python
from langchain.document_loaders import GCSFileLoader
```

安装google-cloud-storage：

```python
# !pip install google-cloud-storage
```

指定项目名、存储桶（bucket)和文件名：

```python
loader = GCSFileLoader(project_name="aist", bucket="testing-hwc", blob="fake.docx")
```

加载数据：

```python
loader.load()
```

可能会收到警告信息，建议使用Service account认证。以下是输出结果：

```python
[Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': '/var/folders/y6/8_bzdg295ld6s1_97_12m4lr0000gn/T/tmp3srlf8n8/fake.docx'}, lookup_index=0)]
```